package com.starbucks.opencase.function;

import com.starbucks.opencase.data.daOnHook;
import com.starbucks.opencase.modualr.moPetOnHook;
import org.springframework.stereotype.Component;

@Component
public class funOnHook {
    public boolean isExit(String uid,String pid){
        for(moPetOnHook mo: daOnHook.pets)if(mo.getPid().equals(pid) && mo.getUid().equals(uid))return true;
        return false;
    }
    public void add(String uid,String pid){
        daOnHook.pets.add(new moPetOnHook(uid,pid,0));
    }
    public void remove(String uid,String pid){
        moPetOnHook mo=query(uid,pid);
        daOnHook.pets.remove(mo);
    }
    public moPetOnHook query(String uid,String pid){
        for(moPetOnHook mo:daOnHook.pets)if(mo.getPid().equals(pid) && mo.getUid().equals(uid))return mo;
        return null;
    }
}
